package soulkun.library.utils.string

import java.util.*
import java.util.regex.Matcher
import java.util.regex.Pattern

object StringUtils {

    private const val EMPTY = ""

    fun concat(vararg arr: Any): String {
        var result = EMPTY
        if (arr.isEmpty()) return EMPTY
        for (o in arr) {
            result += o.toString()
        }
        return result
    }

    fun isEmpty(str: String): Boolean {
        return str.isEmpty()
    }

    fun format(format: String, vararg args: Any): String {
        return String.format(Locale.CHINA, format, *args)
    }

    fun regex(input: CharSequence, regex: String): Matcher {
        val pattern = Pattern.compile(regex)
        return pattern.matcher(input)
    }

}